<?php

class Admin_Form_Arbre extends Zend_Form
{
    public function __construct($options = null)
    {
        parent::__construct($options);
        $this->setName('espece');

        //$idespece = new Zend_Form_Element_Hidden('idespece');

        $longueur = new Zend_Form_Element_Text('longueur');
        $longueur->setLabel('Longueur')
        ->setRequired(true)
        ->addFilter('StripTags')
        ->addFilter('StringTrim')
        ->addValidator('NotEmpty');
        
        $taille = new Zend_Form_Element_Text('taille');
        $taille->setLabel('Taille')
        ->setRequired(true)
        ->addFilter('StripTags')
        ->addFilter('StringTrim')
        ->addValidator('NotEmpty');
        
    	$terrain = new Zend_Form_Element_Select('terrain');
		$terrain->setLabel('Terrain')
         ->setRequired(true)
         ->addFilter('StripTags')
         ->addFilter('StringTrim')
         ->addValidator('NotEmpty');
 
		$table = new Admin_Model_DbTable_Terrain();
		foreach ($table->fetchAll() as $c) {
	    	$terrain->addMultiOption($c->idterrain, $c->matricule);
			}
    	$proprietaire = new Zend_Form_Element_Select('proprietaire');
		$proprietaire->setLabel('PROPIETAIRE')
         ->setRequired(true)
         ->addFilter('StripTags')
         ->addFilter('StringTrim')
         ->addValidator('NotEmpty');
 
		$table = new Admin_Model_DbTable_Terrain();
		foreach ($table->fetchAll() as $c) {
	    	$proprietaire->addMultiOption($c->idterrain, $c->matricule);
			}
			
			
    	$origine = new Zend_Form_Element_Select('origine');
		$origine->setLabel('Origine')
         ->setRequired(true)
         ->addFilter('StripTags')
         ->addFilter('StringTrim')
         ->addValidator('NotEmpty');
 
		$table = new Admin_Model_DbTable_Origine();
		foreach ($table->fetchAll() as $c) {
	    	$origine->addMultiOption($c->idorigine, $c->libOrigine);
			}
			
    	$espece = new Zend_Form_Element_Select('espece');
		$espece->setLabel('Espece')
         ->setRequired(true)
         ->addFilter('StripTags')
         ->addFilter('StringTrim')
         ->addValidator('NotEmpty');
 
		$table = new Admin_Model_DbTable_Espece();
		foreach ($table->fetchAll() as $c) {
	    	$espece->addMultiOption($c->idespece, $c->libEspece);
			}
			
		$latitude = new Zend_Form_Element_Text('latitude');
        $latitude->setLabel('Latitude')
        ->setRequired(true)
        ->addFilter('StripTags')
        ->addFilter('StringTrim')
        ->addValidator('NotEmpty');
        
        $longitude = new Zend_Form_Element_Text('longitude');
        $longitude->setLabel('Longitude')
        ->setRequired(true)
        ->addFilter('StripTags')
        ->addFilter('StringTrim')
        ->addValidator('NotEmpty');
		
        

        

        
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');
        
    
        $this->addElements(array($longueur,$taille,$terrain,$proprietaire,$origine,$espece,$latitude,$longitude,$submit));
    }
    
    
    
   
}